package com.wjb.service.impl;

import com.wjb.mapper.NewsMapper;
import com.wjb.model.EbNews;
import com.wjb.service.NewsService;
import com.wjb.mapper.NewsMapper;
import com.wjb.model.EbNews;
import com.wjb.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.xml.ws.WebServiceClient;
import java.util.List;


@Service
public class NewsServiceImpl implements NewsService {
    @Autowired
    private NewsMapper ebNewsMapper;

    @Override
    public int save(EbNews ebNews){
        return ebNewsMapper.save(ebNews);
    }
    @Autowired
    private NewsMapper ebnNwsMapper;
    @Override
    public List<EbNews> listByPage(int page, int pageSize) {
        int from = (page-1)*pageSize;
        return ebNewsMapper.findByPage(from,pageSize);
    }

    @Override
    public Integer getMaxPage(Integer pageSize) {
        return ebNewsMapper.getMaxPage(pageSize);
    }

    @Override
    public EbNews selectById(Integer enId) {
        return ebNewsMapper.selectById(enId);
    }




    @Override
    public int updateById(EbNews ebNews) {
        return ebNewsMapper.updateByPrimaryKey(ebNews);
    }

    @Override
    public int delete(Integer enId) {
        return ebNewsMapper.remove(enId);
    }


}